<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/common.jsp" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title></title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="">
	<meta http-equiv="description" content="This is my page">
	<script type="text/javascript" src="${CONTEXT_PATH}/common/js/jsonrpc.js"></script>
  </head>
  
  <body>
   		<input type="button" value="hello" onclick="hello()" class="btn" />
   		<input type="button" value="user" onclick="getUser()" class="btn" />
   		<div id="div1"></div>
   		<textarea style="width:800px; height:600px" id="txt1"></textarea>
    
    <script type="text/javascript">
    function hello()
    {
    	//alert(getOneDocument('select username from p_user where id = \'100\'').username);
    	eval('alert(getListDocument(\'select username from p_user\')[2].username)');
    }

    function getUser()
    {
        try
        {
            showLoading();
        	//alert(jsonrpc.userService.queryUserById('200').dept.deptName);
        	//alert(jsonrpc.userService.queryAllUser().list[0].map.username);
        	//allPrpos(jsonrpc.userService.queryUserById('100').roleSet.set);
        	/*var roleSet = jsonrpc.userService.queryUserById('100').roleSet.set;
        	for(var p in roleSet)
        	{
            	alert(roleSet[p].roleName);
            }*/
			alert(jsonrpc.userService.queryAllUserTest().list[0].username);
        }
        finally
        {
        	hideLoading();
        }
    }

    function allPrpos(obj)
	{  
		// 用来保存所有的属性名称和值 
		var props = ""; 
		// 开始遍历 
		for(var p in obj){  
			// 方法 
			//if(typeof(obj[p])=="function"){  
			//	obj[p](); 
			//}else{  
				// p 为属性名称，obj[p]为对应属性的值 
				props+= p + "<br/>"; 
			//}  
		}  
		// 最后显示所有的属性 
		document.getElementById('div1').innerHTML = props; 
	}
    
    </script>
  </body>
</html>
